package main.java.design.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * <p></p>
 *
 * @author : wangdejian
 * @version 1.0
 * @date : 2020/6/21 17:45
 */
public class ConcreateAggregate <T> implements Aggregate<T> {

    private List<T> list = new ArrayList();

    @Override
    public void add(T t) {
        list.add(t);
    }

    @Override
    public void remove(T t) {
        list.remove(t);
    }

    @Override
    public Iterator<T> createIterator() {
        return new ConcreteIterator(list);
    }
}
